package tech.aistar.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tech.aistar.entity.authordis.NoteAuthor;
import tech.aistar.entity.authordis.Notes;
import tech.aistar.entity.authordis.UserTable;

import java.util.List;

/**
 * Created by Dell on 2019/9/26.
 */
@Mapper
public interface NotesMapper {

//    根据游记文章id查出所有游记作者 -- 实现点赞数据和收藏数据回显
    @Select("select * from note_author where id = #{autuorId}")
    NoteAuthor findAll(Notes notes);

/**
 * @Description:查出所有的游记,按时间最新显示
 * @param:
 * @author XiaoDi
 * @date 2019/9/28 17:05
*/
    @Select("select * from notes order by publish_time desc")
    List<Notes> getAllNotes();


    /**
     * @Description:搜索游记,根据标题
     * @param:
     * @author XiaoDi
     * @date 2019/10/2 12:58
    */
    List<Notes> getfindNotePlace(@Param("title") String title);

/**
 * @Description:查询用户名
 * @param:
 * @author XiaoDi
 * @date 2019/9/28 20:53
*/
    @Select("select * from user_table where id =${userId}" )
    UserTable getId(NoteAuthor noteAuthor);


}
